package com.atguigu.gmall.order.client;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.result.Result;
import com.atguigu.gmall.order.client.impl.OrderDegradeFeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;

@FeignClient(value = "service-order",fallback = OrderDegradeFeignClient.class)
public interface OrderFeignClient {

    /**
     * 提交订单，秒杀提交订单使用
     * /api/order/auth/submitOrderSeckill
     * @param orderInfo
     * @return
     */
    @PostMapping("/api/order/auth/submitOrderSeckill")
    public Result submitOrderSeckill(@RequestBody OrderInfo orderInfo);

    /**
     * /api/order/inner/getOrderInfo/{orderId}
     * 根据订单Id 查询订单信息
     * @param orderId
     * @return
     */
    @GetMapping("/api/order/inner/getOrderInfo/{orderId}")
    public OrderInfo getOrderInfo(@PathVariable Long orderId);

    /**
     * 去结算
     * /api/order/auth/trade
     * @return
     */
    @GetMapping("/api/order/auth/trade")
    // public Result trade(HttpServletRequest request);
    // 注：这里不用带request，因为请求本来就是request对象，如果带，调用的时候传request
    public Result trade();
}
